import { request } from './request';
import qs from 'qs'

export function getUserData() {
  return request({
    url: 'getUser'
  });
}


export function registerUser(username, password) {
  return request({
    url: 'reguser',
    method: 'post',
    headers:{
      'Content-type': 'application/x-www-form-urlencoded;charset=utf-8'
  },
    data: qs.stringify({username, password})
  })
}


export function userLogin(username, password) {
  return request({
    url: 'login',
    method: 'post',
    headers:{
      'Content-type': 'application/x-www-form-urlencoded;charset=utf-8'
  },
  data: qs.stringify({username, password})
  })
}

export function adminLogin(username, password) {
  return request({
    url: 'alogin',
    method: 'post',
    headers:{
      'Content-type': 'application/x-www-form-urlencoded;charset=utf-8'
  },
  data: qs.stringify({username, password})
  })
}